﻿<?xml version="1.0" encoding="utf-8" ?>
<DbDataRequest connection="$DBConnection$" type="$ForumDBType$" defaultFormatter="bizobj ApprovalData(approvalSet,lastUpdateBy)">
	<SqlStatement hasResults="true">
		SELECT DISTINCT
			ApprovalData.id AS ApprovalDataid
			,ApprovalData.originalAction as ApprovalDataOriginalAction
			,ApprovalData.state as ApprovalDataState
			,ApprovalData.createdBy as ApprovalDataCreatedById
			,Users.id as LastUpdateById
			,Users.userName as LastUpdateByUserName
			,Users.firstName as LastUpdateByFirstName
			,Users.lastName as LastUpdateByLastName
			,ApprovalData.nextApprover as ApprovalDataNextApprover
			,ApprovalSet.id as ApprovalSetId
			,ApprovalSet.objectType as ApprovalSetObjectType
			,ApprovalSet.saveHistory as ApprovalSetSaveHistory
		FROM ApprovalData INNER JOIN ApprovalSet
			ON ApprovalData.approvalSetId=ApprovalSet.id INNER JOIN Users
				ON Users.id = ApprovalData.lastUpdateBy
		WHERE ApprovalSet.objectType=@typeName AND ApprovalData.objectId=@parentId AND ApprovalData.state=0
	</SqlStatement>
	<Param name="typeName" type="UnicodeVarChar" />
	<Param name="parentId" type="UniqueIdentifier" />
</DbDataRequest >